from time import sleep
import uiautomation
import pyautogui

class yizhuxinxi():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        yizhuxinxi = his.WindowControl(ClassName='Window',Name='医嘱信息')
        changqiyizhu = yizhuxinxi.TabControl(ClassName='TabControl').TabItemControl(AutomationId='changqi',ClassName='TabItem',Name='长期医嘱')
        linshiyizhu = yizhuxinxi.TabControl(ClassName='TabControl').TabItemControl(AutomationId='linshi',ClassName='TabItem',Name='临时医嘱')
        zhixingyizhuanniu = yizhuxinxi.ButtonControl(AutomationId='btnSave', ClassName='Button', Name='执行医嘱')
        #点击长期医嘱
        def click_cqyz(self):
                self.changqiyizhu.Click()
        #点击临时医嘱
        def  click_lsyz(self):
                self.linshiyizhu.Click()
        #点击执行医嘱按钮
        def click_zxyz_btn(self):
                self.zhixingyizhuanniu.Click()


        #执行医嘱窗口
        zhixingyizhuchuangkou =  yizhuxinxi.WindowControl(Name='执行医嘱')
        tuihui = zhixingyizhuchuangkou.ButtonControl(Name='退回')
        zhixing =zhixingyizhuchuangkou.ButtonControl(Name='执行')
        quxiao =zhixingyizhuchuangkou.ButtonControl(Name='取消')

        #点击退回
        def click_th_btn(self):
                self.tuihui.Click()
        #点击执行
        def click_zx_btn(self):
                self.zhixing.Click()
        #点击取消
        def click_qx_btn(self):
                self.quxiao.Click()

        #温馨提示窗口
        wenxintishichuangkou = zhixingyizhuchuangkou.WindowControl(ClassName='Window')
        wxts_shi = wenxintishichuangkou.ButtonControl(Name='是')
        wxts_fou = wenxintishichuangkou.ButtonControl(Name='否')
        #点击是
        def click_wxts_s(self):
                self.wxts_shi.Click()
        #点击否
        def click_wxts_f(self):
                self.wxts_fou.Click()

        #关闭窗口
        def close_window_yzxx(self):
                self.yizhuxinxi.GetWindowPattern().Close()
        def close_window_yzzx(self):
                self.zhixingyizhuchuangkou.GetWindowPattern().Close()
